class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.z: D = None
        self.r: B = None
        self.x: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.x: C = None
        self.r: E = None
        self.t: C = None
        self.v: B = None
        self.txt = txt

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

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

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

b = A("b")
e = B("e")
g = C("g")
n = D("n")
d = E("d")
c = B("c")
m = A("m")
f = C("f")

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

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.x: C = None
        self.r: E = None
        self.t: C = None
        self.v: B = None
        self.txt = txt

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

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

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

b = A("b")
e = B("e")
g = C("g")
n = D("n")
d = E("d")
c = B("c")
m = A("m")
f = C("f")

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