class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: B = None
        self.p: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: C = None
        self.t: A = None
        self.v: B = None
        self.s: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.y: D = None
        self.p: B = None
        self.z: C = None
        self.txt = txt

g = A("g")
d = B("d")
m = C("m")
l = D("l")
k = D("k")
a = C("a")
c = B("c")
j = C("j")

g.t = c
d.y = c
d.p = g
m.x = j
m.t = g
m.v = c
m.s = k
l.v = j
l.z = j
l.y = k
l.p = c
k.v = a
k.z = a
k.y = l
k.p = c
a.x = m
a.t = g
a.v = c
a.s = k
c.y = d
c.p = g
j.x = m
j.t = g
j.v = d
j.s = l
assert m.x.x.v.p.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: B = None
        self.p: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: C = None
        self.t: A = None
        self.v: B = None
        self.s: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.y: D = None
        self.p: B = None
        self.z: C = None
        self.txt = txt

g = A("g")
d = B("d")
m = C("m")
l = D("l")
k = D("k")
a = C("a")
c = B("c")
j = C("j")

g.t = c
d.y = c
d.p = g
m.x = j
m.t = g
m.v = c
m.s = k
l.v = j
l.z = j
l.y = k
l.p = c
k.v = a
k.z = a
k.y = l
k.p = c
a.x = m
a.t = g
a.v = c
a.s = k
c.y = d
c.p = g
j.x = m
j.t = g
j.v = d
j.s = l
assert m.x.x.v.p.txt == "g"