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

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

class C:
    def __init__(self, txt: str):
        self.v: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.z: B = None
        self.x: F = None
        self.o: E = None
        self.v: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.q: D = None
        self.y: B = None
        self.v: B = None
        self.w: C = None
        self.txt = txt

a = A("a")
f = B("f")
b = C("b")
n = D("n")
l = E("l")
h = F("h")
k = F("k")
d = A("d")
c = E("c")

a.p = n
a.o = n
a.w = d
f.z = b
f.t = l
b.v = l
n.p = f
n.z = f
n.x = k
n.o = l
n.v = l
l.u = n
l.r = d
l.x = h
h.q = n
h.y = f
h.v = f
h.w = b
k.q = n
k.y = f
k.v = f
k.w = b
d.p = n
d.o = n
d.w = a
c.u = n
c.r = a
c.x = h
assert n.z.t.u.x.v.z.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.w: A = None
        self.o: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.z: B = None
        self.x: F = None
        self.o: E = None
        self.v: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.q: D = None
        self.y: B = None
        self.v: B = None
        self.w: C = None
        self.txt = txt

a = A("a")
f = B("f")
b = C("b")
n = D("n")
l = E("l")
h = F("h")
k = F("k")
d = A("d")
c = E("c")

a.p = n
a.o = n
a.w = d
f.z = b
f.t = l
b.v = l
n.p = f
n.z = f
n.x = k
n.o = l
n.v = l
l.u = n
l.r = d
l.x = h
h.q = n
h.y = f
h.v = f
h.w = b
k.q = n
k.y = f
k.v = f
k.w = b
d.p = n
d.o = n
d.w = a
c.u = n
c.r = a
c.x = h
assert n.z.t.u.x.v.z.txt == "b"