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

class B:
    def __init__(self, txt: str):
        self.p: C = None
        self.s: B = None
        self.o: B = None
        self.t: A = None
        self.r: B = None
        self.z: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

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

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

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

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

c.o = b
c.r = i
m.p = h
m.z = h
m.s = d
m.o = d
m.r = d
m.t = c
h.t = i
b.v = j
b.r = m
b.s = d
b.t = c
i.t = c
i.z = c
i.q = d
j.w = m
j.t = c
d.p = h
d.z = h
d.s = m
d.o = m
d.r = m
d.t = c
assert c.o.r.p.t.q.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.r: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: C = None
        self.s: B = None
        self.o: B = None
        self.t: A = None
        self.r: B = None
        self.z: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

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

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

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

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

c.o = b
c.r = i
m.p = h
m.z = h
m.s = d
m.o = d
m.r = d
m.t = c
h.t = i
b.v = j
b.r = m
b.s = d
b.t = c
i.t = c
i.z = c
i.q = d
j.w = m
j.t = c
d.p = h
d.z = h
d.s = m
d.o = m
d.r = m
d.t = c
assert c.o.r.p.t.q.txt == "d"