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

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

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

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

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

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

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

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

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

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

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

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

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

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

n.o = j
l.z = d
l.w = c
d.w = a
d.q = l
d.x = f
f.z = d
f.t = c
f.s = b
c.w = h
a.t = c
a.o = n
a.p = l
a.x = j
j.z = d
j.t = c
j.s = a
b.t = c
b.o = n
b.p = l
b.x = j
h.w = b
h.q = l
h.x = j
assert c.w.x.t.w.w.x.txt == "j"