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

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

class C:
    def __init__(self, txt: str):
        self.v: C = None
        self.p: C = None
        self.r: B = None
        self.t: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.y: B = None
        self.o: B = None
        self.v: A = None
        self.txt = txt

l = A("l")
f = B("f")
n = C("n")
j = D("j")
i = A("i")
c = B("c")
m = C("m")
g = C("g")
e = D("e")

l.q = i
l.y = f
l.z = c
l.v = g
f.x = l
f.w = g
f.p = c
n.v = m
n.p = m
n.r = f
n.t = c
j.r = n
j.y = c
j.o = c
j.v = i
i.q = l
i.y = f
i.z = c
i.v = n
c.x = i
c.w = m
c.p = f
m.v = g
m.p = g
m.r = f
m.t = c
g.v = n
g.p = m
g.r = c
g.t = c
e.r = m
e.y = c
e.o = c
e.v = i
assert g.r.p.w.p.t.x.txt == "
class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.y: B = None
        self.z: B = None
        self.v: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: C = None
        self.p: C = None
        self.r: B = None
        self.t: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.y: B = None
        self.o: B = None
        self.v: A = None
        self.txt = txt

l = A("l")
f = B("f")
n = C("n")
j = D("j")
i = A("i")
c = B("c")
m = C("m")
g = C("g")
e = D("e")

l.q = i
l.y = f
l.z = c
l.v = g
f.x = l
f.w = g
f.p = c
n.v = m
n.p = m
n.r = f
n.t = c
j.r = n
j.y = c
j.o = c
j.v = i
i.q = l
i.y = f
i.z = c
i.v = n
c.x = i
c.w = m
c.p = f
m.v = g
m.p = g
m.r = f
m.t = c
g.v = n
g.p = m
g.r = c
g.t = c
e.r = m
e.y = c
e.o = c
e.v = i
assert g.r.p.w.p.t.x.txt == "i"