class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.o: B = None
        self.u: F = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.w: E = None
        self.p: A = None
        self.txt = txt

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

b.r = h
b.o = e
b.u = m
e.r = m
e.o = m
h.u = m
h.s = e
h.t = e
h.r = b
h.y = b
h.x = g
c.p = d
d.x = e
d.r = e
d.o = e
d.q = h
d.s = g
d.w = m
m.w = d
m.p = b
g.p = d
assert g.p.w.w.q.x.p.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.o: B = None
        self.u: F = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.w: E = None
        self.p: A = None
        self.txt = txt

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

b.r = h
b.o = e
b.u = m
e.r = m
e.o = m
h.u = m
h.s = e
h.t = e
h.r = b
h.y = b
h.x = g
c.p = d
d.x = e
d.r = e
d.o = e
d.q = h
d.s = g
d.w = m
m.w = d
m.p = b
g.p = d
assert g.p.w.w.q.x.p.txt == "d"