class A:
    def __init__(self, txt: str):
        self.z: E = None
        self.s: F = None
        self.t: A = None
        self.p: C = None
        self.txt = txt

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

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

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

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

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

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

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

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

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

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

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

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

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

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