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

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

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

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

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

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

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

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

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

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

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

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

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

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

h.p = a
j.r = l
j.z = l
j.v = l
j.w = h
g.z = h
g.r = b
l.r = i
l.t = d
l.y = m
l.z = g
i.x = h
a.x = m
a.o = l
a.q = l
a.t = j
a.w = b
n.z = h
n.r = i
d.r = l
d.z = l
d.v = l
d.w = h
b.x = h
m.x = h
assert m.x.p.t.r.txt == "l"