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

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

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

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

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

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

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

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

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

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

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

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

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

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

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