class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.v: B = None
        self.p: C = None
        self.txt = txt

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

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

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

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

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

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

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

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

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

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

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

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

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

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