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

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

class C:
    def __init__(self, txt: str):
        self.w: C = None
        self.y: E = None
        self.x: A = None
        self.p: A = None
        self.t: E = None
        self.s: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.o: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.t: A = None
        self.z: A = None
        self.p: F = None
        self.s: B = None
        self.y: A = None
        self.r: F = None
        self.txt = txt

e = A("e")
d = B("d")
j = C("j")
h = D("h")
b = E("b")
n = F("n")
g = F("g")
m = C("m")

e.q = b
e.t = g
d.x = b
j.w = m
j.y = b
j.t = b
j.s = b
j.x = e
j.p = e
h.p = d
h.o = e
b.w = j
b.q = h
n.t = e
n.z = e
n.y = e
n.p = g
n.r = g
n.s = d
g.t = e
g.z = e
g.y = e
g.p = n
g.r = n
g.s = d
m.w = j
m.y = b
m.t = b
m.s = b
m.x = e
m.p = e
assert e.t.r.s.x.q.p.x.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.t: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: C = None
        self.y: E = None
        self.x: A = None
        self.p: A = None
        self.t: E = None
        self.s: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.o: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.t: A = None
        self.z: A = None
        self.p: F = None
        self.s: B = None
        self.y: A = None
        self.r: F = None
        self.txt = txt

e = A("e")
d = B("d")
j = C("j")
h = D("h")
b = E("b")
n = F("n")
g = F("g")
m = C("m")

e.q = b
e.t = g
d.x = b
j.w = m
j.y = b
j.t = b
j.s = b
j.x = e
j.p = e
h.p = d
h.o = e
b.w = j
b.q = h
n.t = e
n.z = e
n.y = e
n.p = g
n.r = g
n.s = d
g.t = e
g.z = e
g.y = e
g.p = n
g.r = n
g.s = d
m.w = j
m.y = b
m.t = b
m.s = b
m.x = e
m.p = e
assert e.t.r.s.x.q.p.x.q.txt == "h"