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

class B:
    def __init__(self, txt: str):
        self.s: E = None
        self.p: A = None
        self.u: B = None
        self.w: B = None
        self.r: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: D = None
        self.y: F = None
        self.r: C = None
        self.t: E = None
        self.txt = txt

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

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

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

k = A("k")
h = B("h")
j = C("j")
m = D("m")
b = E("b")
l = F("l")
f = C("f")
d = A("d")
a = B("a")

k.t = l
k.w = l
k.p = b
h.s = b
h.p = k
h.u = a
h.w = a
h.r = l
j.u = m
j.y = l
j.r = f
j.t = b
m.t = a
m.w = a
b.y = a
l.z = f
l.q = h
f.u = m
f.y = l
f.r = j
f.t = b
d.t = l
d.w = l
d.p = b
a.s = b
a.p = k
a.u = h
a.w = h
a.r = l
assert j.y.q.p.t.z.r.y.q.txt == "
class A:
    def __init__(self, txt: str):
        self.t: F = None
        self.p: E = None
        self.w: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: E = None
        self.p: A = None
        self.u: B = None
        self.w: B = None
        self.r: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: D = None
        self.y: F = None
        self.r: C = None
        self.t: E = None
        self.txt = txt

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

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

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

k = A("k")
h = B("h")
j = C("j")
m = D("m")
b = E("b")
l = F("l")
f = C("f")
d = A("d")
a = B("a")

k.t = l
k.w = l
k.p = b
h.s = b
h.p = k
h.u = a
h.w = a
h.r = l
j.u = m
j.y = l
j.r = f
j.t = b
m.t = a
m.w = a
b.y = a
l.z = f
l.q = h
f.u = m
f.y = l
f.r = j
f.t = b
d.t = l
d.w = l
d.p = b
a.s = b
a.p = k
a.u = h
a.w = h
a.r = l
assert j.y.q.p.t.z.r.y.q.txt == "h"