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

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

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

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

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

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

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

l.y = h
l.x = n
l.u = n
l.z = c
l.r = c
n.t = g
n.q = g
b.x = n
b.u = f
b.p = l
g.p = c
c.r = g
c.o = g
c.w = f
f.p = n
j.p = n
i.x = n
i.u = f
i.p = l
h.x = n
h.u = j
h.p = l
assert h.x.q.p.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.x: B = None
        self.z: E = None
        self.r: E = None
        self.u: B = None
        self.txt = txt

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

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

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

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

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

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

l.y = h
l.x = n
l.u = n
l.z = c
l.r = c
n.t = g
n.q = g
b.x = n
b.u = f
b.p = l
g.p = c
c.r = g
c.o = g
c.w = f
f.p = n
j.p = n
i.x = n
i.u = f
i.p = l
h.x = n
h.u = j
h.p = l
assert h.x.q.p.txt == "c"