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

class B:
    def __init__(self, txt: str):
        self.q: E = None
        self.p: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: E = None
        self.w: A = None
        self.v: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.u: F = None
        self.p: C = None
        self.txt = txt

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.q: E = None
        self.p: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: E = None
        self.w: A = None
        self.v: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.u: F = None
        self.p: C = None
        self.txt = txt

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

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

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

m.x = h
m.q = h
m.o = a
m.r = d
b.q = h
b.p = h
i.o = h
i.w = m
i.v = a
a.t = i
a.p = i
a.u = e
h.r = b
h.t = b
h.y = b
h.x = m
e.x = b
e.p = b
e.r = b
d.x = b
d.p = b
d.r = b
assert b.p.x.r.p.txt == "b"