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

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

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

class D:
    def __init__(self, txt: str):
        self.w: F = None
        self.txt = txt

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

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

c = A("c")
a = B("a")
h = C("h")
g = D("g")
d = E("d")
j = F("j")
b = C("b")

c.o = b
a.r = h
a.q = j
a.o = d
h.r = d
h.p = b
h.t = g
h.o = c
h.u = c
g.w = j
d.t = j
d.v = c
d.z = c
d.w = b
d.r = a
j.y = c
j.v = c
j.r = a
j.o = d
j.s = b
b.r = d
b.p = h
b.t = g
b.o = c
b.u = c
assert b.t.w.s.r.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: F = None
        self.txt = txt

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

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

c = A("c")
a = B("a")
h = C("h")
g = D("g")
d = E("d")
j = F("j")
b = C("b")

c.o = b
a.r = h
a.q = j
a.o = d
h.r = d
h.p = b
h.t = g
h.o = c
h.u = c
g.w = j
d.t = j
d.v = c
d.z = c
d.w = b
d.r = a
j.y = c
j.v = c
j.r = a
j.o = d
j.s = b
b.r = d
b.p = h
b.t = g
b.o = c
b.u = c
assert b.t.w.s.r.txt == "d"