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

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

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

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

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

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

g = A("g")
f = B("f")
d = C("d")
a = D("a")
i = E("i")
k = F("k")
j = D("j")
l = F("l")

g.p = d
f.p = g
f.r = i
f.x = d
d.u = k
a.u = f
a.y = g
i.y = d
i.u = k
i.z = l
i.o = f
i.p = f
i.x = f
k.t = l
k.r = a
j.u = f
j.y = g
l.t = k
l.r = a
assert j.y.p.u.r.y.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

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

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

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

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

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

g = A("g")
f = B("f")
d = C("d")
a = D("a")
i = E("i")
k = F("k")
j = D("j")
l = F("l")

g.p = d
f.p = g
f.r = i
f.x = d
d.u = k
a.u = f
a.y = g
i.y = d
i.u = k
i.z = l
i.o = f
i.p = f
i.x = f
k.t = l
k.r = a
j.u = f
j.y = g
l.t = k
l.r = a
assert j.y.p.u.r.y.txt == "g"