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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

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

l.r = k
l.z = n
n.w = h
n.s = l
k.r = l
k.w = n
d.o = l
d.p = l
d.y = c
d.t = c
d.x = h
h.y = k
c.u = n
assert n.s.r.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.z: B = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

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

l.r = k
l.z = n
n.w = h
n.s = l
k.r = l
k.w = n
d.o = l
d.p = l
d.y = c
d.t = c
d.x = h
h.y = k
c.u = n
assert n.s.r.w.w.txt == "h"