class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: A = None
        self.r: E = None
        self.v: D = None
        self.t: E = None
        self.o: D = None
        self.p: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: F = None
        self.u: B = None
        self.z: B = None
        self.x: F = None
        self.y: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: E = None
        self.q: F = None
        self.o: A = None
        self.txt = txt

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

b = A("b")
m = B("m")
i = C("i")
d = D("d")
h = E("h")
c = F("c")
e = F("e")
f = B("f")
l = E("l")

b.x = d
m.x = f
i.q = b
i.p = b
i.r = h
i.v = d
i.o = d
i.t = l
d.o = c
d.x = c
d.u = m
d.z = m
d.y = b
h.t = l
h.q = c
h.o = b
c.p = m
c.z = m
c.y = h
c.v = d
c.t = f
c.r = i
e.p = f
e.z = f
e.y = h
e.v = d
e.t = m
e.r = i
f.x = m
l.t = h
l.q = c
l.o = b
assert i.o.y.x.o.z.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: A = None
        self.r: E = None
        self.v: D = None
        self.t: E = None
        self.o: D = None
        self.p: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: F = None
        self.u: B = None
        self.z: B = None
        self.x: F = None
        self.y: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: E = None
        self.q: F = None
        self.o: A = None
        self.txt = txt

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

b = A("b")
m = B("m")
i = C("i")
d = D("d")
h = E("h")
c = F("c")
e = F("e")
f = B("f")
l = E("l")

b.x = d
m.x = f
i.q = b
i.p = b
i.r = h
i.v = d
i.o = d
i.t = l
d.o = c
d.x = c
d.u = m
d.z = m
d.y = b
h.t = l
h.q = c
h.o = b
c.p = m
c.z = m
c.y = h
c.v = d
c.t = f
c.r = i
e.p = f
e.z = f
e.y = h
e.v = d
e.t = m
e.r = i
f.x = m
l.t = h
l.q = c
l.o = b
assert i.o.y.x.o.z.x.x.x.txt == "f"