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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.o: C = None
        self.u: C = None
        self.t: B = None
        self.s: E = None
        self.txt = txt

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.o: C = None
        self.u: C = None
        self.t: B = None
        self.s: E = None
        self.txt = txt

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

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