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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.y: A = None
        self.txt = txt

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

i = A("i")
j = B("j")
b = C("b")
l = D("l")
d = E("d")
a = F("a")
k = F("k")
h = F("h")
e = F("e")
n = A("n")

i.r = e
j.x = i
j.w = i
j.p = d
j.r = n
b.x = l
b.s = d
l.w = b
l.o = b
l.s = h
l.q = j
l.x = j
l.z = d
d.u = a
d.y = n
a.q = n
a.w = b
k.q = i
k.w = b
h.q = i
h.w = b
e.q = n
e.w = b
n.r = h
assert h.q.r.w.s.txt == "
class A:
    def __init__(self, txt: str):
        self.r: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.y: A = None
        self.txt = txt

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

i = A("i")
j = B("j")
b = C("b")
l = D("l")
d = E("d")
a = F("a")
k = F("k")
h = F("h")
e = F("e")
n = A("n")

i.r = e
j.x = i
j.w = i
j.p = d
j.r = n
b.x = l
b.s = d
l.w = b
l.o = b
l.s = h
l.q = j
l.x = j
l.z = d
d.u = a
d.y = n
a.q = n
a.w = b
k.q = i
k.w = b
h.q = i
h.w = b
e.q = n
e.w = b
n.r = h
assert h.q.r.w.s.txt == "d"