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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.r: D = None
        self.t: B = None
        self.p: C = None
        self.txt = txt

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.r: D = None
        self.t: B = None
        self.p: C = None
        self.txt = txt

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

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