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

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

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

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

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

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

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

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

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

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

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

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

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

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

a.q = h
b.u = j
b.x = l
b.t = l
b.o = h
k.p = h
k.u = h
k.y = j
k.w = g
k.s = l
k.r = l
h.v = l
h.r = g
l.p = c
j.r = b
c.q = h
g.u = j
g.x = l
g.t = l
g.o = h
f.p = h
f.u = h
f.y = j
f.w = g
f.s = l
f.r = l
d.p = h
d.u = h
d.y = j
d.w = b
d.s = l
d.r = l
assert k.s.p.q.r.o.r.u.r.txt == "b"