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

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

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

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.y: B = None
        self.q: F = None
        self.x: F = None
        self.s: C = None
        self.z: E = None
        self.txt = txt

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

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

k = A("k")
l = B("l")
j = C("j")
m = D("m")
g = E("g")
h = F("h")
i = C("i")
b = D("b")

k.r = m
k.s = g
l.s = h
l.x = h
j.p = m
m.o = l
m.y = l
m.q = h
m.x = h
m.s = i
m.z = g
g.y = b
g.u = i
g.z = l
h.v = g
h.r = g
i.p = b
b.o = l
b.y = l
b.q = h
b.x = h
b.s = i
b.z = g
assert h.r.y.o.x.v.y.q.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.s: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.y: B = None
        self.q: F = None
        self.x: F = None
        self.s: C = None
        self.z: E = None
        self.txt = txt

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

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

k = A("k")
l = B("l")
j = C("j")
m = D("m")
g = E("g")
h = F("h")
i = C("i")
b = D("b")

k.r = m
k.s = g
l.s = h
l.x = h
j.p = m
m.o = l
m.y = l
m.q = h
m.x = h
m.s = i
m.z = g
g.y = b
g.u = i
g.z = l
h.v = g
h.r = g
i.p = b
b.o = l
b.y = l
b.q = h
b.x = h
b.s = i
b.z = g
assert h.r.y.o.x.v.y.q.txt == "h"