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

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

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

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

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

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

l = A("l")
g = B("g")
a = C("a")
i = D("i")
b = E("b")
e = F("e")
m = F("m")
c = B("c")
f = D("f")
h = F("h")

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

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

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

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

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

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

l = A("l")
g = B("g")
a = C("a")
i = D("i")
b = E("b")
e = F("e")
m = F("m")
c = B("c")
f = D("f")
h = F("h")

l.p = a
l.y = c
g.s = i
g.w = b
g.r = c
a.r = c
a.x = f
a.q = f
a.s = b
a.z = b
a.o = h
i.x = f
i.y = b
b.y = a
b.p = a
e.u = l
m.u = l
c.s = f
c.w = b
c.r = g
f.x = i
f.y = b
h.u = l
assert f.y.y.z.y.txt == "a"